import request from '@/utils/request'

// 查询选课记录列表
export function listSelection(query) {
  return request({
    url: '/course/selection/list',
    method: 'get',
    params: query
  })
}

// 查询选课记录详细
export function getSelection(recordId) {
  return request({
    url: '/course/selection/' + recordId,
    method: 'get'
  })
}

// 新增选课记录
export function addSelection(data) {
  return request({
    url: '/course/selection',
    method: 'post',
    data: data
  })
}

// 修改选课记录
export function updateSelection(data) {
  return request({
    url: '/course/selection',
    method: 'put',
    data: data
  })
}

// 删除选课记录
export function delSelection(recordId) {
  return request({
    url: '/course/selection/' + recordId,
    method: 'delete'
  })
}

// 根据studentId、courseId查询选课记录列表
export function getSelectionByStudentId(studentId) {
  return request({
    url: `/course/selection/student/${studentId}`,
    method: 'get'
  })
}
export function getSelectionByCourseId(courseId) {
  return request({
    url: `/course/selection/course/${courseId}`,
    method: 'get'
  })
}
